<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>资料详情</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <link rel="stylesheet" href="/static/wx/lib/sui/sm.min.css" />
    <link rel="stylesheet" href="/static/wx/lib/sui/sm-extend.min.css" />
    <link rel="stylesheet" href="/static/wx/css/reset.css" />
    <link rel="stylesheet" href="/static/wx/css/main.css" />
    <link rel="stylesheet" href="/static/wx/css/public_main.css" />
  </head>

  <body>
    <div class="page-group">
      <div class="page page-current" id="rep_data_no_audit">
        <!-- 主内容 -->
        <div class="content">
          <div class="item-card" style="padding:.5rem 0">
            <div class="item-card-header">状态：{$info.status_name}</div>
          </div>
          <div class="item-card">
            <div class="item-card-content">
              {if(isset($user))}
              <div class="item-card-content-item">代录人姓名：{$user.username}</div>
              <div class="item-card-content-item">代录人手机号：{$user.mobile}</div>
              <div class="item-card-content-item">录人类型：{$user.type_name}</div>
              {/if}
              <div class="item-card-content-item">录人时间：{$info.created_at}</div>
            </div>
          </div>
          <div class="item-card">
            <div class="item-card-header">
              <div>保单险种</div>
              <input type="hidden" value="{$info.policy_num}" id="policy_num">
              <!--{if(isset($data['policy_return']))}-->
              <!--<div class="btn" onclick="return_msg(1)">修改驳回原因</div>-->
              <!--{else}-->
              <!--<div class="btn" onclick="return_msg(1)">驳回</div>-->
              <!--{/if}-->
            </div>
            <div class="item-card-content">
              <div class="item-card-content-item">保单号：{$info.report_num}</div>
              <div class="item-card-content-item">报案号：{$info.policy_num}</div>
              <div class="item-card-content-item">出险险种：{$info.insurant_type_name}</div>
            </div>
            <div class="edit-content">
              {if(isset($data['policy_return']))}
              {foreach($data['policy_return'] as $k =>$v)}
              {if($v)}
              <p>修改内容：{$v}</p>
              {/if}
              {/foreach}
              {/if}
            </div>
          </div>
          <div class="item-card">
            <div class="item-card-header">
              <div>货品信息</div>
              {if(isset($data['goods_return']))}
              <div class="btn" onclick="return_msg(2)">修改驳回原因</div>
              {else}
              <div class="btn" onclick="return_msg(2)">驳回</div>
              {/if}
            </div>
            <div class="item-card-content">
              <div class="item-card-content-item">货品类别：{$info.goods_type_name}</div>
              <div class="item-card-content-item">货品名称：{$info.goods_name}</div>
              <div class="item-card-content-item">数量与规格：{$info.goods_num}</div>
              <div class="item-card-content-item">物品原值：{$info.good_price}万元</div>
            </div>
            <div class="edit-content">
              {if(isset($data['goods_return']))}
              {foreach($data['goods_return'] as $k =>$v)}
              {if($v)}
              <p>修改内容：{$v}</p>
              {/if}
              {/foreach}
              {/if}
            </div>
          </div>
          <div class="item-card">
            <div class="item-card-header">
              <div>货品受损</div>
              {if(isset($data['under_return']))}
              <div class="btn" onclick="return_msg(3)">修改驳回原因</div>
              {else}
              <div class="btn" onclick="return_msg(3)">驳回</div>
              {/if}
            </div>
            <div class="item-card-content">
              <div class="item-card-content-item">
                受损时间：{$info.damage_at}
              </div>
              <div class="item-card-content-item">
                受损原因：{$info.damage_result}
              </div>
              <div class="item-card-content-item" style="display:flex">
                <div>货品所在地：</div>
                <div>
                  <div>{$info.omit | default=''}{$info.city | default=''}{$info.classify | default=''}</div>
                  <div>{$info.address_detail}</div>
                </div>
              </div>
              <div class="item-card-content-item">第三方报告：调查报告.doc</div>
            </div>
            <div class="edit-content">
              {if(isset($data['under_return']))}
              {foreach($data['under_return'] as $k =>$v)}
              {if($v)}
              <p>修改内容：{$v}</p>
              {/if}
              {/foreach}
              {/if}
            </div>
          </div>
          <div class="item-card">
            <div class="item-card-header">
              <div>货品现状</div>
              {if(isset($data['situation_return']))}
              <div class="btn" onclick="return_msg(4)">修改驳回原因</div>
              {else}
              <div class="btn" onclick="return_msg(4)">驳回</div>
              {/if}
            </div>
            <div class="item-card-content">
              <div class="item-card-content-item">
                货品在{$info.present_at}时的现状
              </div>
              <div class="item-card-content-item">货品清单：货品清单.doc</div>
              <div class="item-card-content-item">货品描述：{$info.goods_desc}</div>
              <div
                class="item-card-content-item"
                style="display:flex;align-items:center;"
              >
                <div>上传的照片：</div>
                <div class="pre-view">
                  {if(isset($info.present_img))}
                  <ul class="uploader__files" id="uploaderFiles">
                    {foreach($info.present_img as $v)}
                    <li class="uploader__file" style="background-image:url({$v})"></li>
                    {/foreach}
                  </ul>
                  {/if}
                </div>
              </div>
              <div
                class="item-card-content-item"
                style="display:flex;align-items:center;"
              >
                <div>上传的视频：</div>
                <div class="pre-view">预览</div>
              </div>
            </div>
            <div class="edit-content">
              {if(isset($data['situation_return']))}
              {foreach($data['situation_return'] as $k =>$v)}
              {if($v)}
              <p>修改内容：{$v}</p>
              {/if}
              {/foreach}
              {/if}
            </div>
          </div>
          <div class="item-card">
            <div class="item-card-header">
              <div class="">物权信息</div>
              {if(isset($data['info_return']))}
              <div class="btn" onclick="return_msg(5)">修改驳回原因</div>
              {else}
              <div class="btn" onclick="return_msg(5)">驳回</div>
              {/if}
            </div>
            <div class="item-card-content">
              <div class="item-card-content-item">
                要求在{$info.should_at} 前处置完成
              </div>
              <div class="item-card-content-item">物权单位：{$info.rem_company}</div>
              <div class="item-card-content-item">联系人：{$info.linkman}</div>
              <div class="item-card-content-item">手机号：{$info.connect_phone}</div>
            </div>
            <div class="edit-content">
              {if(isset($data['info_return']))}
              {foreach($data['info_return'] as $k =>$v)}
              {if($v)}
              <p>修改内容：{$v}</p>
              {/if}
              {/foreach}
              {/if}
            </div>
          </div>
          
            <div class="item-card">
                <div class="item-card-header"><div>授权书</div>
                  {if(isset($data['certificate_return']))}
                  <div class="btn" onclick="return_msg(6)">修改驳回原因</div>
                  {else}
                  <div class="btn" onclick="return_msg(6)">驳回</div>
                  {/if}</div>
                <div class="item-card-content">
                    <div class="item-card-content-item" style="display:flex;align-items:center;">
                        <div>授权书：</div>
                        <div class="pre-view">
                            预览
                        </div>
                    </div>
                </div>
              <div class="edit-content">
                {if(isset($data['certificate_return']))}
                {foreach($data['certificate_return'] as $k =>$v)}
                {if($v)}
                <p>修改内容：{$v}</p>
                {/if}
                {/foreach}
                {/if}
              </div>
            </div>
         
          <div class="btn-box" style="margin-top: 1rem;">
            <div class="flex size-m">
              <div class="pre-step my-btn" style="width: 47%;">
                <input type="hidden" id="p_id" value="{$info.p_id}">
                <span id="return"
                  style="background-color: rgb(255, 255, 255); color:#e4393c;border:1px solid #e4393c;"
                  >提交驳回修改</span
                >
              </div>
              <div class="pre-step my-btn" style="width: 47%;">
                <span class="active" id="submit">确认通过</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script
      type="text/javascript"
      src="/static/wx/lib/sui/zepto.min.js"
      charset="utf-8"
    ></script>
    <script
      type="text/javascript"
      src="/static/wx/lib/sui/sm.min.js"
      charset="utf-8"
    ></script>
    <script
      type="text/javascript"
      src="/static/wx/lib/sui/sm-extend.min.js"
      charset="utf-8"
    ></script>
  </body>
</html>
<script>
  function return_msg(type) {
      var p_id = $('#p_id').val();
      var policy_num = $('#policy_num').val();
      $.prompt('驳回原因',
          function (value) {
              $.ajax({
                  url:'/wx/SaleMan/save_policy_msg',
                  type:'post',
                  dataType:'json',
                  data:{
                      'p_id':p_id,
                      'type':type,
                      'msg':value,
                  },
                  success:function (data) {
                      if(data.code ==200){
                          window.location.href = '/wx/SaleMan/return_policy?policy_num='+policy_num;
                      }else{
                          $.alert(data.msg);
                      }
                  }
              });
          },
          function (value) {

          }
      );
  }

  $('#submit').on('touchend',function() {
      var p_id = $('#p_id').val();
      $.ajax({
          url:'/wx/SaleMan/pass_policy',
          type:'post',
          dataType:'json',
          data:{
              'p_id':p_id,
          },
          success:function (data) {
              if(data.code ==200){
                  $.alert('操作成功');
                  window.location.href = '/wx/SaleMan/index?type=1';
              }else{
                  $.alert(data.msg);
              }
          }
      });
  });


  $('#return').on('touchend',function() {
      var p_id = $('#p_id').val();
      $.confirm('未提交驳回原因，不予提交','提示',
          function () {
              $.ajax({
                  url:'/wx/SaleMan/return_policy_msg',
                  type:'post',
                  dataType:'json',
                  data:{
                      'p_id':p_id,
                  },
                  success:function (data) {
                      if(data.code ==200){
                          $.alert('修改成功');
                          window.location.href = '/wx/SaleMan/index?type=1';
                      }else{
                          $.alert(data.msg);
                      }
                  }
              });
          },
          function () {
              return false;
          }
      );
  });

</script>

